<template>
  <div class="home">
    <el-container>
      <el-header class="top-box">
        <el-row :gutter="24">
          <el-col :span="18"> </el-col>
          <el-col :span="6">
            <div class="right-box">
              <span>lyx</span>
              <el-button class="out-button" @click="toLogin" type="text">退出</el-button>
            </div>
          </el-col>
        </el-row>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <el-menu class="el-menu-vertical-demo" router>
            <el-menu-item :router="i.path" v-for="i in tabList" :key="i.name" :index="i.name"> 
             <!-- <i class="el-icon-document"></i>-->
              <template #title>{{i.meta.title}}</template>
            </el-menu-item>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
  
</template>

<script>

import {useRouter } from "vue-router"
export default {
  name: "Home",
  setup() {
    const router = useRouter();
    let tabList = router.options.routes[0].children;
    
    const toLogin = () => {
      router.push({
        name: "Login",
      });
    };
    return {
      toLogin,
      tabList,
    }
  },
  
};
</script>

<style lang="scss" scoped>
.top-box {
  background: #34aee2;
  padding: 5px;
  .right-box {
    text-align: right;
  }
  .out-button {
    margin-left: 10px;
  }
}
</style>

